body {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}
.container {
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  display: flex;
}
.sun {
  background-color: #ddd;
}
.moon {
  background-color: #444;
}
.container input[type="checkbox"] {
  visibility: hidden;
  display: none;
}
.container *,
.container ::after,
.container ::before {
  box-sizing: border-box;
}

.container .switch {
  position: relative;
  width: 111px;
  height: 48px;
  display: inline-block;
  filter: drop-shadow(0 4px 4px #ccc);
}

/* The slider */
.container .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #f4f4f5;
  transition: .4s;
  border-radius: 30px;
}

.container .slider:before {
  position: absolute;
  content: "";
  height: 38px;
  width: 38px;
  border-radius: 20px;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(40deg,#ff0080,#ff8c00 70%);
  transition: .4s;
}

.container input:checked + .slider {
  background-color: #444;
}

.container input:checked + .slider:before {
  left: calc(100% - (38px + 8px));
  background: #444;
  box-shadow: inset -3px -2px 5px -2px #8983f7, inset -10px -4px 0 0 #a3dafb;
}
